/**
 * Author@ Cheng Feitian
 * Date: 2021-3-30
 * Description: 全局函数做友元
 */

#include <algorithm>
#include <iostream>
#include <string>

using namespace std;
const int maxn = 1024;

class Building
{
    //goodGay全局函数是building好朋友，可以访问building中私有成员
    friend void goodGay(Building &building);
private:
    string m_BedRoom;
public:
    string m_SittingRoom;   //客厅

    Building();
    ~Building();
};

Building::Building()
{
    m_SittingRoom = "客厅";
    m_BedRoom = "卧室";
}

Building::~Building()
{
}

//全局函数
void goodGay(Building &building){
    cout << "好基友全局函数 正在访问:" << building.m_SittingRoom << endl;

    cout << "好基友全局函数 正在访问:" << building.m_BedRoom << endl;
}

void test01(){
    Building building;
    goodGay(building);
}

int main()
{
    test01();
    return 0;
}
